﻿	/*
MiniAccess支持的实体属性的映射方式有如下几种：
<entity name="" table="" command-type="" insert="" 
              delete="" multiple-delete="" update="" multiple-update="" fetch="" search="" >
	<primary-key name="" column="" update="true|flase" insert="true|false"/>
	<property name=""    column="" update="true|flase" insert="true|false"/>
	<many-to-one name="" column="" update="true|flase" insert="true|false"/>
	<one-to-one name="" column="" update="true|flase" insert="true|false"/>
</entity>
下面是根据数据生成的基本映射框架，可以复制到程序集下“程序集名字.mdm.xml”中修改使用，比如修改程序集和连接字符串的设置等。
<?xml version="1.0" encoding="utf-8" ?>
<miniaccess-mapping xmlns="urn:miniacess-mapping-1.0" >
	<access-type name="System.Data.SqlClient">
		<provider name="Searcher" entity-namespace="Ruandao.Searcher.EntityAccess" is-debug="true">
			<entity name="CategoryEntity" table="Category" ></entity>
			<entity name="CategoryContentEntity" table="CategoryContent" ></entity>
			<entity name="ContentTagsEntity" table="ContentTags" ></entity>
			<entity name="MultitagEntity" table="Multitag" ></entity>
			<entity name="MultitagContentEntity" table="MultitagContent" ></entity>
			<entity name="SearcherEntity" table="Searcher" ></entity>
			<entity name="TagEntity" table="Tag" ></entity>
		</provider>
	</access-type>
</miniaccess-mapping>
*/
//-----------------------------------------------------------------
// 该代码文件由CodeSmith的MiniAccess.cst模板创建，运行时需要MiniAccess程序集的支持。 
// 创建者  :  WuGui.Yang
// 创建时间:  2012年5月15日
//-----------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Configuration;

/// <summary>
/// 包含存取AppBaseDatabase数据库的Access工具类和所有Entity实体类。
/// <br/>这些类均实现为Partial方式，使用时可以在单独的文件中扩展这些类的成员。
/// </summary>
namespace Ruandao.Searcher.EntityAccess
{
    using Ruandao.MiniAccess;
	using Ruandao.MiniAccess.SqlServer;

    /// <summary>
	/// 该类封装了SqlServerAccess针对具体某个数据库的IAccess的一个实例，提供了存取AppBaseDatabase数据库的工具方法。
    /// <br/>该类使用了单例模式，没有公开构造方法，只能通过GetInstance()获取类的实例。
    /// </summary>
	public sealed partial class SearcherAccess : SqlServerAccess
	{
        private SearcherAccess()
            : base( Assembly.GetAssembly(typeof(SearcherAccess)),
                    "Searcher",
                    GetConnectionString("Searcher"))
        { }
	}
    

	/// <summary>
	/// Table [Category] MiniAccess Entity Class 
	/// </summary>
	public partial class CategoryEntity : EntityBase< CategoryEntity >
	{
		#region Construct

		public CategoryEntity():base(SearcherAccess.GetInstance())
        {
            // 此处无需代码。
        }
		
		#endregion
		
		#region Get and Set Properties for All Columns.

		private int categoryId = 0;
		public int CategoryId
		{
			get { return this.categoryId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.categoryId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("categoryId", this.categoryId);
                    this.categoryId = value;
                }
			}
		}

		private int searcherId = 0;
		public int SearcherId
		{
			get { return this.searcherId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.searcherId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("searcherId", this.searcherId);
                    this.searcherId = value;
                }
			}
		}

		private int parentId = 0;
		public int ParentId
		{
			get { return this.parentId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.parentId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("parentId", this.parentId);
                    this.parentId = value;
                }
			}
		}

		private string idPath = String.Empty;
		public string IdPath
		{
			get { return this.idPath; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.idPath != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("idPath", this.idPath);
                    this.idPath = value;
                }
			}
		}

		private string title = String.Empty;
		public string Title
		{
			get { return this.title; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.title != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("title", this.title);
                    this.title = value;
                }
			}
		}

		private string description = String.Empty;
		public string Description
		{
			get { return this.description; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.description != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("description", this.description);
                    this.description = value;
                }
			}
		}

		private int contentAmount = 0;
		public int ContentAmount
		{
			get { return this.contentAmount; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.contentAmount != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("contentAmount", this.contentAmount);
                    this.contentAmount = value;
                }
			}
		}

		private byte[] cachedContentIdsBinary;
		public byte[] CachedContentIdsBinary
		{
			get { return this.cachedContentIdsBinary; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.cachedContentIdsBinary != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("cachedContentIdsBinary", this.cachedContentIdsBinary);
                    this.cachedContentIdsBinary = value;
                }
			}
		}
		
		#endregion

		#region 获取主键所对应外键表的实体集合。
		// 函数名以Get打头，后面接着是外键表的名称，最后是Entities后缀。

		public IList< CategoryContentEntity > GetCategoryContentEntities()
		{
			return SearcherAccess.GetInstance().SearchEntities< CategoryContentEntity >("WHERE CategoryId="+categoryId);
		}
		
		#endregion
		
		#region 获取外键所对应的实体。
		// 函数名以Get打头，后面部分是外键的名称，如果外键的名称以"FK_<表名>_"开始，则只取后半部分的名称。
		
		public SearcherEntity GetSearch()
		{
			return SearcherAccess.GetInstance().FetechEntity< SearcherEntity >(searcherId);
		}
		
		#endregion

		#region static Method
		
		// 根据主键查找和删除实体的函数。
		
		public static CategoryEntity Fetch(int categoryId)
		{
            return SearcherAccess.GetInstance().FetechEntity< CategoryEntity >(categoryId);
		}
		public static int Delete(int categoryId)
		{
            return SearcherAccess.GetInstance().DeleteEntity< CategoryEntity >(categoryId);
		}
		
		
        // 获取表中的所有记录。
		public static IList< CategoryEntity > GetAllEntities()
		{
            return SearcherAccess.GetInstance().SearchEntities< CategoryEntity >("");
		} 
		
        // 根据条件查找表中的记录。
		public static IList< CategoryEntity > SearchEntities(string condition)
		{
            return SearcherAccess.GetInstance().SearchEntities< CategoryEntity >(condition);
		} 
		#endregion
		
	}

	/// <summary>
	/// Table [CategoryContent] MiniAccess Entity Class 
	/// </summary>
	public partial class CategoryContentEntity : EntityBase< CategoryContentEntity >
	{
		#region Construct

		public CategoryContentEntity():base(SearcherAccess.GetInstance())
        {
            // 此处无需代码。
        }
		
		#endregion
		
		#region Get and Set Properties for All Columns.

		private int categoryId = 0;
		public int CategoryId
		{
			get { return this.categoryId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.categoryId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("categoryId", this.categoryId);
                    this.categoryId = value;
                }
			}
		}

		private int contentId = 0;
		public int ContentId
		{
			get { return this.contentId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.contentId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("contentId", this.contentId);
                    this.contentId = value;
                }
			}
		}
		
		#endregion

		#region 获取主键所对应外键表的实体集合。
		// 函数名以Get打头，后面接着是外键表的名称，最后是Entities后缀。

		
		#endregion
		
		#region 获取外键所对应的实体。
		// 函数名以Get打头，后面部分是外键的名称，如果外键的名称以"FK_<表名>_"开始，则只取后半部分的名称。
		
		public CategoryEntity GetCategory()
		{
			return SearcherAccess.GetInstance().FetechEntity< CategoryEntity >(categoryId);
		}
		
		#endregion

		#region static Method
		
		// 根据主键查找和删除实体的函数。
		
		public static CategoryContentEntity Fetch(int categoryId,int contentId)
		{
            return SearcherAccess.GetInstance().FetechEntity< CategoryContentEntity >(categoryId,contentId);
		}
		public static int Delete(int categoryId,int contentId)
		{
            return SearcherAccess.GetInstance().DeleteEntity< CategoryContentEntity >(categoryId,contentId);
		}
		
		
        // 获取表中的所有记录。
		public static IList< CategoryContentEntity > GetAllEntities()
		{
            return SearcherAccess.GetInstance().SearchEntities< CategoryContentEntity >("");
		} 
		
        // 根据条件查找表中的记录。
		public static IList< CategoryContentEntity > SearchEntities(string condition)
		{
            return SearcherAccess.GetInstance().SearchEntities< CategoryContentEntity >(condition);
		} 
		#endregion
		
	}

	/// <summary>
	/// Table [ContentTags] MiniAccess Entity Class 
	/// </summary>
	public partial class ContentTagsEntity : EntityBase< ContentTagsEntity >
	{
		#region Construct

		public ContentTagsEntity():base(SearcherAccess.GetInstance())
        {
            // 此处无需代码。
        }
		
		#endregion
		
		#region Get and Set Properties for All Columns.

		private int searcherId = 0;
		public int SearcherId
		{
			get { return this.searcherId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.searcherId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("searcherId", this.searcherId);
                    this.searcherId = value;
                }
			}
		}

		private int contentId = 0;
		public int ContentId
		{
			get { return this.contentId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.contentId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("contentId", this.contentId);
                    this.contentId = value;
                }
			}
		}

		private byte[] tagIdsBinary;
		public byte[] TagIdsBinary
		{
			get { return this.tagIdsBinary; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagIdsBinary != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagIdsBinary", this.tagIdsBinary);
                    this.tagIdsBinary = value;
                }
			}
		}

		private int tagCount = 0;
		public int TagCount
		{
			get { return this.tagCount; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagCount != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagCount", this.tagCount);
                    this.tagCount = value;
                }
			}
		}
		
		#endregion

		#region 获取主键所对应外键表的实体集合。
		// 函数名以Get打头，后面接着是外键表的名称，最后是Entities后缀。

		
		#endregion
		
		#region 获取外键所对应的实体。
		// 函数名以Get打头，后面部分是外键的名称，如果外键的名称以"FK_<表名>_"开始，则只取后半部分的名称。
		
		public SearcherEntity GetSearcher()
		{
			return SearcherAccess.GetInstance().FetechEntity< SearcherEntity >(searcherId);
		}
		
		#endregion

		#region static Method
		
		// 根据主键查找和删除实体的函数。
		
		public static ContentTagsEntity Fetch(int searcherId,int contentId)
		{
            return SearcherAccess.GetInstance().FetechEntity< ContentTagsEntity >(searcherId,contentId);
		}
		public static int Delete(int searcherId,int contentId)
		{
            return SearcherAccess.GetInstance().DeleteEntity< ContentTagsEntity >(searcherId,contentId);
		}
		
		
        // 获取表中的所有记录。
		public static IList< ContentTagsEntity > GetAllEntities()
		{
            return SearcherAccess.GetInstance().SearchEntities< ContentTagsEntity >("");
		} 
		
        // 根据条件查找表中的记录。
		public static IList< ContentTagsEntity > SearchEntities(string condition)
		{
            return SearcherAccess.GetInstance().SearchEntities< ContentTagsEntity >(condition);
		} 
		#endregion
		
	}

	/// <summary>
	/// Table [Multitag] MiniAccess Entity Class 
	/// </summary>
	public partial class MultitagEntity : EntityBase< MultitagEntity >
	{
		#region Construct

		public MultitagEntity():base(SearcherAccess.GetInstance())
        {
            // 此处无需代码。
        }
		
		#endregion
		
		#region Get and Set Properties for All Columns.

		private int multitagId = 0;
		public int MultitagId
		{
			get { return this.multitagId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.multitagId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("multitagId", this.multitagId);
                    this.multitagId = value;
                }
			}
		}

		private int searcherId = 0;
		public int SearcherId
		{
			get { return this.searcherId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.searcherId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("searcherId", this.searcherId);
                    this.searcherId = value;
                }
			}
		}

		private int tagNumber = 0;
		public int TagNumber
		{
			get { return this.tagNumber; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagNumber != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagNumber", this.tagNumber);
                    this.tagNumber = value;
                }
			}
		}

		private int tagId0 = 0;
		public int TagId0
		{
			get { return this.tagId0; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagId0 != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagId0", this.tagId0);
                    this.tagId0 = value;
                }
			}
		}

		private int tagId1 = 0;
		public int TagId1
		{
			get { return this.tagId1; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagId1 != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagId1", this.tagId1);
                    this.tagId1 = value;
                }
			}
		}

		private int tagId2 = 0;
		public int TagId2
		{
			get { return this.tagId2; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagId2 != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagId2", this.tagId2);
                    this.tagId2 = value;
                }
			}
		}

		private int tagId3 = 0;
		public int TagId3
		{
			get { return this.tagId3; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagId3 != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagId3", this.tagId3);
                    this.tagId3 = value;
                }
			}
		}

		private int tagId4 = 0;
		public int TagId4
		{
			get { return this.tagId4; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagId4 != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagId4", this.tagId4);
                    this.tagId4 = value;
                }
			}
		}

		private int accessCounter = 0;
		public int AccessCounter
		{
			get { return this.accessCounter; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.accessCounter != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("accessCounter", this.accessCounter);
                    this.accessCounter = value;
                }
			}
		}

		private DateTime lastAccessTime = DateTime.MaxValue;
		public DateTime LastAccessTime
		{
			get { return this.lastAccessTime; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.lastAccessTime != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("lastAccessTime", this.lastAccessTime);
                    this.lastAccessTime = value;
                }
			}
		}

		private int contentAmount = 0;
		public int ContentAmount
		{
			get { return this.contentAmount; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.contentAmount != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("contentAmount", this.contentAmount);
                    this.contentAmount = value;
                }
			}
		}

		private byte[] cachedContentIdsBinary;
		public byte[] CachedContentIdsBinary
		{
			get { return this.cachedContentIdsBinary; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.cachedContentIdsBinary != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("cachedContentIdsBinary", this.cachedContentIdsBinary);
                    this.cachedContentIdsBinary = value;
                }
			}
		}

		private byte[] cachedSubTags;
		public byte[] CachedSubTags
		{
			get { return this.cachedSubTags; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.cachedSubTags != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("cachedSubTags", this.cachedSubTags);
                    this.cachedSubTags = value;
                }
			}
		}

		private bool cacheIsOld;
		public bool CacheIsOld
		{
			get { return this.cacheIsOld; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.cacheIsOld != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("cacheIsOld", this.cacheIsOld);
                    this.cacheIsOld = value;
                }
			}
		}
		
		#endregion

		#region 获取主键所对应外键表的实体集合。
		// 函数名以Get打头，后面接着是外键表的名称，最后是Entities后缀。

		public IList< MultitagContentEntity > GetMultitagContentEntities()
		{
			return SearcherAccess.GetInstance().SearchEntities< MultitagContentEntity >("WHERE MultitagId="+multitagId);
		}
		
		#endregion
		
		#region 获取外键所对应的实体。
		// 函数名以Get打头，后面部分是外键的名称，如果外键的名称以"FK_<表名>_"开始，则只取后半部分的名称。
		
		public SearcherEntity GetFK_Mulitag_Searcher()
		{
			return SearcherAccess.GetInstance().FetechEntity< SearcherEntity >(searcherId);
		}
		
		#endregion

		#region static Method
		
		// 根据主键查找和删除实体的函数。
		
		public static MultitagEntity Fetch(int multitagId)
		{
            return SearcherAccess.GetInstance().FetechEntity< MultitagEntity >(multitagId);
		}
		public static int Delete(int multitagId)
		{
            return SearcherAccess.GetInstance().DeleteEntity< MultitagEntity >(multitagId);
		}
		
        // 根据唯一索引（UIX_TagId01234）查找和删除实体的函数。
		public static MultitagEntity FetchByUIX_TagId01234(int tagId0,int tagId1,int tagId2,int tagId3,int tagId4)
		{
			string condition = "WHERE " + 
				"TagId0=" + tagId0.ToString() + " AND " + 
				"TagId1=" + tagId1.ToString() + " AND " + 
				"TagId2=" + tagId2.ToString() + " AND " + 
				"TagId3=" + tagId3.ToString() + " AND " + 
				"TagId4=" + tagId4.ToString();
            return SearcherAccess.GetInstance().FindEntity< MultitagEntity >("WHERE " + 
				"TagId0=" + tagId0.ToString() + " AND " + 
				"TagId1=" + tagId1.ToString() + " AND " + 
				"TagId2=" + tagId2.ToString() + " AND " + 
				"TagId3=" + tagId3.ToString() + " AND " + 
				"TagId4=" + tagId4.ToString());
		} 
		public static int DeleteByUIX_TagId01234(int tagId0,int tagId1,int tagId2,int tagId3,int tagId4)
		{
			string condition = "WHERE " + 
				"TagId0=" + tagId0.ToString() + " AND " + 
				"TagId1=" + tagId1.ToString() + " AND " + 
				"TagId2=" + tagId2.ToString() + " AND " + 
				"TagId3=" + tagId3.ToString() + " AND " + 
				"TagId4=" + tagId4.ToString();
            return SearcherAccess.GetInstance().DeleteEntities< MultitagEntity >("WHERE " + 
				"TagId0=" + tagId0.ToString() + " AND " + 
				"TagId1=" + tagId1.ToString() + " AND " + 
				"TagId2=" + tagId2.ToString() + " AND " + 
				"TagId3=" + tagId3.ToString() + " AND " + 
				"TagId4=" + tagId4.ToString());
		} 
		
        // 获取表中的所有记录。
		public static IList< MultitagEntity > GetAllEntities()
		{
            return SearcherAccess.GetInstance().SearchEntities< MultitagEntity >("");
		} 
		
        // 根据条件查找表中的记录。
		public static IList< MultitagEntity > SearchEntities(string condition)
		{
            return SearcherAccess.GetInstance().SearchEntities< MultitagEntity >(condition);
		} 
		#endregion
		
	}

	/// <summary>
	/// Table [MultitagContent] MiniAccess Entity Class 
	/// </summary>
	public partial class MultitagContentEntity : EntityBase< MultitagContentEntity >
	{
		#region Construct

		public MultitagContentEntity():base(SearcherAccess.GetInstance())
        {
            // 此处无需代码。
        }
		
		#endregion
		
		#region Get and Set Properties for All Columns.

		private int multitagId = 0;
		public int MultitagId
		{
			get { return this.multitagId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.multitagId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("multitagId", this.multitagId);
                    this.multitagId = value;
                }
			}
		}

		private int contentId = 0;
		public int ContentId
		{
			get { return this.contentId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.contentId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("contentId", this.contentId);
                    this.contentId = value;
                }
			}
		}
		
		#endregion

		#region 获取主键所对应外键表的实体集合。
		// 函数名以Get打头，后面接着是外键表的名称，最后是Entities后缀。

		
		#endregion
		
		#region 获取外键所对应的实体。
		// 函数名以Get打头，后面部分是外键的名称，如果外键的名称以"FK_<表名>_"开始，则只取后半部分的名称。
		
		public MultitagEntity GetMultitag()
		{
			return SearcherAccess.GetInstance().FetechEntity< MultitagEntity >(multitagId);
		}
		
		#endregion

		#region static Method
		
		// 根据主键查找和删除实体的函数。
		
		public static MultitagContentEntity Fetch(int multitagId,int contentId)
		{
            return SearcherAccess.GetInstance().FetechEntity< MultitagContentEntity >(multitagId,contentId);
		}
		public static int Delete(int multitagId,int contentId)
		{
            return SearcherAccess.GetInstance().DeleteEntity< MultitagContentEntity >(multitagId,contentId);
		}
		
		
        // 获取表中的所有记录。
		public static IList< MultitagContentEntity > GetAllEntities()
		{
            return SearcherAccess.GetInstance().SearchEntities< MultitagContentEntity >("");
		} 
		
        // 根据条件查找表中的记录。
		public static IList< MultitagContentEntity > SearchEntities(string condition)
		{
            return SearcherAccess.GetInstance().SearchEntities< MultitagContentEntity >(condition);
		} 
		#endregion
		
	}

	/// <summary>
	/// Table [Searcher] MiniAccess Entity Class 
	/// </summary>
	public partial class SearcherEntity : EntityBase< SearcherEntity >
	{
		#region Construct

		public SearcherEntity():base(SearcherAccess.GetInstance())
        {
            // 此处无需代码。
        }
		
		#endregion
		
		#region Get and Set Properties for All Columns.

		private int searcherId = 0;
		public int SearcherId
		{
			get { return this.searcherId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.searcherId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("searcherId", this.searcherId);
                    this.searcherId = value;
                }
			}
		}

		private string registerBy = String.Empty;
		public string RegisterBy
		{
			get { return this.registerBy; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.registerBy != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("registerBy", this.registerBy);
                    this.registerBy = value;
                }
			}
		}

		private DateTime registerTime = DateTime.MaxValue;
		public DateTime RegisterTime
		{
			get { return this.registerTime; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.registerTime != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("registerTime", this.registerTime);
                    this.registerTime = value;
                }
			}
		}
		
		#endregion

		#region 获取主键所对应外键表的实体集合。
		// 函数名以Get打头，后面接着是外键表的名称，最后是Entities后缀。

		public IList< CategoryEntity > GetCategoryEntities()
		{
			return SearcherAccess.GetInstance().SearchEntities< CategoryEntity >("WHERE SearcherId="+searcherId);
		}
		public IList< ContentTagsEntity > GetContentTagsEntities()
		{
			return SearcherAccess.GetInstance().SearchEntities< ContentTagsEntity >("WHERE SearcherId="+searcherId);
		}
		public IList< MultitagEntity > GetMultitagEntities()
		{
			return SearcherAccess.GetInstance().SearchEntities< MultitagEntity >("WHERE SearcherId="+searcherId);
		}
		public IList< TagEntity > GetTagEntities()
		{
			return SearcherAccess.GetInstance().SearchEntities< TagEntity >("WHERE SearcherId="+searcherId);
		}
		
		#endregion
		
		#region 获取外键所对应的实体。
		// 函数名以Get打头，后面部分是外键的名称，如果外键的名称以"FK_<表名>_"开始，则只取后半部分的名称。
		
		
		#endregion

		#region static Method
		
		// 根据主键查找和删除实体的函数。
		
		public static SearcherEntity Fetch(int searcherId)
		{
            return SearcherAccess.GetInstance().FetechEntity< SearcherEntity >(searcherId);
		}
		public static int Delete(int searcherId)
		{
            return SearcherAccess.GetInstance().DeleteEntity< SearcherEntity >(searcherId);
		}
		
		
        // 获取表中的所有记录。
		public static IList< SearcherEntity > GetAllEntities()
		{
            return SearcherAccess.GetInstance().SearchEntities< SearcherEntity >("");
		} 
		
        // 根据条件查找表中的记录。
		public static IList< SearcherEntity > SearchEntities(string condition)
		{
            return SearcherAccess.GetInstance().SearchEntities< SearcherEntity >(condition);
		} 
		#endregion
		
	}

	/// <summary>
	/// Table [Tag] MiniAccess Entity Class 
	/// </summary>
	public partial class TagEntity : EntityBase< TagEntity >
	{
		#region Construct

		public TagEntity():base(SearcherAccess.GetInstance())
        {
            // 此处无需代码。
        }
		
		#endregion
		
		#region Get and Set Properties for All Columns.

		private int tagId = 0;
		public int TagId
		{
			get { return this.tagId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagId", this.tagId);
                    this.tagId = value;
                }
			}
		}

		private int searcherId = 0;
		public int SearcherId
		{
			get { return this.searcherId; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.searcherId != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("searcherId", this.searcherId);
                    this.searcherId = value;
                }
			}
		}

		private string tagName = String.Empty;
		public string TagName
		{
			get { return this.tagName; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.tagName != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("tagName", this.tagName);
                    this.tagName = value;
                }
			}
		}

		private string description = String.Empty;
		public string Description
		{
			get { return this.description; }
			set
			{
                if (this.IsDelete) throw new OrMapException("不能修改已经标识为删除的实体的属性。");
                if (this.description != value)
                {
                    if ( !this.IsNew ) ChangePropertyValue("description", this.description);
                    this.description = value;
                }
			}
		}
		
		#endregion

		#region 获取主键所对应外键表的实体集合。
		// 函数名以Get打头，后面接着是外键表的名称，最后是Entities后缀。

		
		#endregion
		
		#region 获取外键所对应的实体。
		// 函数名以Get打头，后面部分是外键的名称，如果外键的名称以"FK_<表名>_"开始，则只取后半部分的名称。
		
		public SearcherEntity GetSearcher()
		{
			return SearcherAccess.GetInstance().FetechEntity< SearcherEntity >(searcherId);
		}
		
		#endregion

		#region static Method
		
		// 根据主键查找和删除实体的函数。
		
		public static TagEntity Fetch(int tagId)
		{
            return SearcherAccess.GetInstance().FetechEntity< TagEntity >(tagId);
		}
		public static int Delete(int tagId)
		{
            return SearcherAccess.GetInstance().DeleteEntity< TagEntity >(tagId);
		}
		
        // 根据唯一索引（UIX_SearcherId_TagName）查找和删除实体的函数。
		public static TagEntity FetchByUIX_SearcherId_TagName(int searcherId,string tagName)
		{
			string condition = "WHERE " + 
				"SearcherId=" + searcherId.ToString() + " AND " + 
				"TagName='" + tagName.ToString() + "'";
            return SearcherAccess.GetInstance().FindEntity< TagEntity >("WHERE " + 
				"SearcherId=" + searcherId.ToString() + " AND " + 
				"TagName='" + tagName.ToString() + "'");
		} 
		public static int DeleteByUIX_SearcherId_TagName(int searcherId,string tagName)
		{
			string condition = "WHERE " + 
				"SearcherId=" + searcherId.ToString() + " AND " + 
				"TagName='" + tagName.ToString() + "'";
            return SearcherAccess.GetInstance().DeleteEntities< TagEntity >("WHERE " + 
				"SearcherId=" + searcherId.ToString() + " AND " + 
				"TagName='" + tagName.ToString() + "'");
		} 
		
        // 获取表中的所有记录。
		public static IList< TagEntity > GetAllEntities()
		{
            return SearcherAccess.GetInstance().SearchEntities< TagEntity >("");
		} 
		
        // 根据条件查找表中的记录。
		public static IList< TagEntity > SearchEntities(string condition)
		{
            return SearcherAccess.GetInstance().SearchEntities< TagEntity >(condition);
		} 
		#endregion
		
	}
}
